from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views

router = DefaultRouter()
router.register(r'workflows', views.WorkflowViewSet)
router.register(r'workflow-nodes', views.WorkflowNodeViewSet)
router.register(r'workflow-instances', views.WorkflowInstanceViewSet)

app_name = 'flows'

urlpatterns = [
    path('', include(router.urls)),
    path('workflows/<int:workflow_id>/start_instance/', 
         views.WorkflowViewSet.as_view({'post': 'start_instance'}),
         name='start-workflow-instance'),
    path('workflow-instances/<int:instance_id>/process/',
         views.WorkflowInstanceViewSet.as_view({'post': 'process'}),
         name='process-workflow-instance'),
] 